/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.suli.inventory.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import me.zhengjie.base.BaseEntity;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
* @website https://eladmin.vip
* @description /
* @author WYH
* @date 2024-02-01
**/
@Entity
@Data
@Table(name="inventory")
public class Inventory extends BaseEntity implements Serializable {

    @Id
    @Column(name = "`id`")
    @ApiModelProperty(value = "主键")
    private String id;

    @Column(name = "`location_code`")
    @ApiModelProperty(value = "库位号")
    private String locationCode;

    @Column(name = "`warehouse_code`")
    @ApiModelProperty(value = "所属仓库")
    private String warehouseCode;

    @Column(name = "`zone_code`")
    @ApiModelProperty(value = "所属库区")
    private String zoneCode;
    /**
     * 1：暂存区，2：立库
     */
    @Column(name = "`area_code`")
    @ApiModelProperty(value = "所属区域")
    private String areaCode;

    @Column(name = "`warehouse_location`")
    @ApiModelProperty(value = "库位")
    private String warehouseLocation;

    @Column(name = "`grade`")
    @ApiModelProperty(value = "等级")
    private String grade;

    @Column(name = "`box_number`")
    @ApiModelProperty(value = "箱号条码")
    private String boxNumber;

    @Column(name = "`source_documents`")
    @ApiModelProperty(value = "来源单据")
    private String sourceDocuments;

    @Column(name = "`material_code`")
    @ApiModelProperty(value = "物料编码")
    private String materialCode;

    @Column(name = "`material_name`")
    @ApiModelProperty(value = "物料名称")
    private String materialName;

    @Column(name = "`material_number`")
    @ApiModelProperty(value = "物料数量")
    private BigDecimal materialNumber;

    @Column(name = "`lot_code`")
    @ApiModelProperty(value = "批次号")
    private String lotCode;

    @Column(name = "`el_unit`")
    @ApiModelProperty(value = "单位")
    private String elUnit;

    @Column(name = "`vmi_code`")
    @ApiModelProperty(value = "是否VMI")
    private String vmiCode;

    @Column(name = "`wa_no`")
    @ApiModelProperty("工厂")
    private String waNo;

    @Column(name = "`is_hold`")
    @ApiModelProperty(value = "冻结标识")
    private int isHold;

    @Column(name = "`su_no`")
    @ApiModelProperty(value = "供应商代码")
    private String suNo;

    @Column(name = "`ch_seq`")
    @ApiModelProperty(value = "项目号")
    private String chSeq;

    @Column(name = "`start_date`")
    @CreationTimestamp
    @ApiModelProperty(value = "入库时间")
    private Timestamp startDate;

    @Column(name = "`hold_quantity`")
    @ApiModelProperty(value = "冻结数量")
    private BigDecimal holdQuantity;

    @Column(name = "`total`")
    @ApiModelProperty(value = "总数")
    private BigDecimal total;

    @Column(name = "`available_quantity`")
    @ApiModelProperty(value = "可用数量")
    private BigDecimal availableQuantity;

    @Column(name = "`traycode`")
    @ApiModelProperty(value = "料箱号")
    private String trayCode;

    @Column(name = "`su_name`")
    @ApiModelProperty(value = "供应商名称")
    private String suName;

    @Column(name = "`el_mkdate`")
    @ApiModelProperty(value = "制造时间")
    private String elMkDate;

    public void copy(Inventory source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
